
package com.jf.cloud.search.controller.multishop;

import com.jf.cloud.api.dto.EsPageDTO;
import com.jf.cloud.api.vo.EsPageVO;
import com.jf.cloud.common.order.dto.OrderInvoiceSearchDTO;
import com.jf.cloud.common.order.vo.EsOrderInvoiceVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.search.manager.OrderInvoiceSearchManager;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 商品搜索
 * @author zz
 * @date 2020/11/16
 */
@RestController("multishopOrderInvoiceSearchController")
@RequestMapping("/m/order_invoice_search")
@Tag(name = "multishop-订单发票管理接口")
public class OrderInvoiceSearchController {

    @Autowired
    private OrderInvoiceSearchManager orderInvoiceSearchManager;

    @GetMapping("/page")
    @Operation(summary = "获取订单发票列表" , description = "分页获取列表")
    public ServerResponseEntity<EsPageVO<EsOrderInvoiceVO>> page(@Valid EsPageDTO pageDTO, @ParameterObject OrderInvoiceSearchDTO orderInvoiceSearchDTO) {
        orderInvoiceSearchDTO.setShopId(AuthUserContext.get().getTenantId());
        EsPageVO<EsOrderInvoiceVO> page = orderInvoiceSearchManager.page(pageDTO, orderInvoiceSearchDTO);
        return ServerResponseEntity.success(page);
    }
}
